import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
    state: {
        selectedTime: '',
        selectedClass: '',
    },
    mutations: {
        setSelectedTime(state, time) {
            state.selectedTime = time;
        },
        setSelectedClass(state, className) {
            state.selectedClass = className;
        },
    },
    actions: {
        updateSelectedTime({ commit }, time) {
            commit('setSelectedTime', time);
        },
        updateSelectedClass({ commit }, className) {  // 新增 updateSelectedClass action
            console.log("更新 selectedClass:", className);  // 添加日志
            commit('setSelectedClass', className);
        },
    }

});
